Z-coder: a fast adaptive binary arithmetic coder

ABSTRACT

A binary arithmetic coder and decoder provides improved coding accuracy due to improved probability estimation and adaptation. They also provide improved decoding speed through a “fast path” design wherein decoding of a most probable symbol requires few computational steps. Coded data represents data that is populated by more probable symbols (“MPS”) and less probable symbols (“LPS”). In an embodiment, a decoder receives a segment of the coded data as a binary fraction C. It defines a coding interval of possible values of C, the interval extending from a variable lower bound A to a constant upper bound 1. For each position in the decoded symbol string, the decoder computes a test value Z that subdivides the coding interval into sub-intervals according to the relative probabilities that an MPS or an LPS occurs in the position. A first sub-interval extends from the lower bound A to the test value Z; the second sub-interval extending from the test value Z to  1.  If C is greater than Z, the decoder emits an MPS for the current position in the decoded symbol string and sets the lower bound A to the test variable Z for use during decoding of the next position in the decoded symbol string. If C is less than Z, the decoder emits an LPS and computes a new lower bound A and a new binary fraction C for use during decoding of the next position in the decoded symbol string. The encoder operates according to analogous techniques to compose coded data from original data.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention relates to an improved adaptive binaryarithmetic coder that provides improved processing speed and accuracyover conventional arithmetic coders.

[0003] 2. Related Art

[0004] Arithmetic coders provide well-known algorithms for encodingdata. Compression ratios of the arithmetic coders can reach theinformation theory limit. The arithmetic coder and decoder must possessgood estimates of the probability distribution of each symbol to code.For each symbol to be coded in a string element, the encoder and decodermust possess a table containing estimated probabilities for theoccurrence of each possible symbol at each point in the symbol string.The coders themselves must perform a table search and at least onemultiplication. For this reason, arithmetic coders incur highcomputational expense. Binary adaptive arithmetic coders, such as the“Q-Coder,” by Pennebaker, et al. (1998) and the “QM-Coder,” by Ono(1993), have been developed to overcome this drawback.

[0005] A high-level system diagram of a prior art binary arithmeticcoder is shown in FIG. 1. Data to be coded is input to an-encoder 100.The encoder 100 encodes the data and outputs a string of coded data to achannel 200. A decoder 300 retrieves the code string from the channel200 and replicates the original data by decoding the coded data.

[0006] The coding process often is described by the operation of thedecoder 300. In the decoder, the code string is interpreted as a binaryrepresentation of a real number contained in the unit interval [0,1[.The binary arithmetic coder divides the unit interval into twosub-intervals having lengths that are proportional to the estimatedprobabilities of each value of the first bit in the symbol string. Anycode string located in a first, lower sub-interval represents a symbolstring starting with a zero (0). Conversely, any code string located inthe upper sub-interval represents a symbol string starting with a one(1).

[0007] Each of the sub-intervals can be divided into two smallersub-intervals having lengths that are proportional to the estimatedconditional probabilities of the second symbol bit given the previouslyencoded symbol bit. Any code string located in one of thesesub-intervals represents a symbol string starting with the correspondingtwo bit prefix.

[0008] The decoding process is repeated. Sub-intervals are themselvesdivided into smaller sub-intervals representing probabilities of thevalue of the next bit in the symbol string. The process produces apartition of the unit interval having sub-intervals that correspond toeach possible value of the symbol string. Any code string in theinterval can be chosen corresponding to the encoded symbol string.

[0009] According to theory, when an interval is divided intosub-intervals, the length of each sub-interval should be proportional tothe probability of the value of the next data symbol to be decoded giventhe previous symbol bits. The probability distribution of the codestring therefore would be uniform in the interval. Since each code bitis equally likely to be a 0 or a 1, it would carry as much informationas information theory allows. In other words, the coder would achieveentropic compression.

[0010] The known Q-Coder and QM-Coder, while they represent advancesover traditional arithmetic coders, do not provide performance thatapproaches entropic compression. Thus, there is a need in the art for abinary arithmetic coder that provides improved compression ratios thanthe Q-Code and the QM-Coder.

[0011] Decoding speed is an important performance characteristic of datacoding systems. Decoding latency, the time that is required to generatedecoded data once the coded data is received should be minimizedwherever possible. Thus, decoders that introduce lengthy or complexcomputational processes to the decoding operation are disfavored.Accordingly, there is a need in the art for a data decoding scheme thatis computationally simple and provides improved throughput of decodeddata.

SUMMARY OF THE INVENTION

[0012] The present invention provides a binary arithmetic coder anddecoder having important advantages over the prior art. The codingscheme provides improved coding accuracy over the prior art due toimproved probability estimation and adaptation. It provides improveddecoding speed through a “fast path” design wherein decoding of a mostprobable symbol requires few computational steps.

[0013] According to the present invention, coded data represents datathat is populated by more probable symbols (“MPS”) and less probablesymbols (“LPS”). In an embodiment, the decoder receives a segment of thecoded data as a binary fraction C. It defines a coding interval ofpossible values of C, the interval extending from a variable lower boundA to a constant upper bound 1. For each position in the decoded symbolstring, the decoder computes a test value Z that subdivides the codinginterval into sub-intervals according to the relative probabilities thatan MPS or an LPS occurs in the position. A first sub-interval extendsfrom the lower bound A to the test value Z; the second sub-intervalextending from the test value Z to 1. If C is greater than Z, thedecoder emits an MPS for the current position in the decoded symbolstring and sets the lower bound A to the test variable Z for use duringdecoding of the next position in the decoded symbol string. If C is lessthan Z, the decoder emits an LPS and computes a new lower bound A and anew binary fraction C for use during decoding of the next position inthe decoded symbol string. The encoder operates according to analogoustechniques to compose coded data from original data.

BRIEF DESCRIPTION OF THE DRAWINGS

[0014]FIG. 1 is a high-level system block diagram of a known binaryarithmetic coder.

[0015]FIG. 2 illustrates a method of operation of a decoder according toa first embodiment of the present invention.

[0016]FIGS. 3 and 4 respectively illustrate interval parameters as afunction of interval splitting variables in an entropic codingapplication and a QM Coder of the prior art.

[0017]FIG. 5 illustrates interval parameters as a function of aninterval splitting variable in the present invention.

[0018]FIG. 6 illustrates a method of operation of a decoder according toa second embodiment of the present invention.

[0019]FIG. 7 illustrates a method of operation of an encoder accordingto an embodiment of the present invention.

[0020]FIG. 8 is a graph illustrating a comparison between an optimalincrement parameter and an increment parameter in use in an embodimentof the present invention.

[0021]FIG. 9 illustrates a method of operation of a decoder according toa third embodiment of the present invention.

DETAILED DESCRIPTION

[0022] The present invention provides a data coding system, labeled the“Z-Coder,” that provides improved compression ratios over traditionalbinary arithmetic coders. The decoder of the Z-Coder system may beoptimized to provide very fast decoding of coded data.

[0023] To facilitate an understanding of the invention, the decodingscheme of the present invention is described first. A method ofoperation 1000 of a decoder according to a first embodiment of thepresent invention is shown in FIG. 2. The decoder decodes a coded datastring, labeled “C(t),” into decoded data. The decoded data is a stringof symbols that may be either a most probable symbol (“MPS”) or a leastprobable symbol (“LPS”). C(t) is treated by the decoder as a binaryfraction. For example, a coded data string “1010101011111111” is treatedas “0.1010101011111111”.

[0024] When C(t) is received and before the decoder tests its value,C(t) may take any value between 0 and 1 (C(t)ε [0,1[). The decodermaintains a second variable, labeled “A(t),” that represents a lowerbound of possible values of C(t). Thus, the decoder sets A(1)=0 as aninitial step (Step 1010) and further sets C(1) to a code string receivedfrom the channel (Step 1020).

[0025] Decoding of the t^(th) code symbol operates according to steps1030-1080. At step 1030, the decoder computes a test variable, labeled“Z(t)”, that divides the interval [(A(t),1[ in proportion to therelative probabilities of MPS and LPS (Step 1030). The decoder comparesthe actual value of C(t) against the test variable Z(t) to determinewhich is greater (Step 1040). If C(t) is greater than Z(t), the decoderdetermines that the next symbol to be decoded is a MPS (Step 1050). Thedecoder sets A(t+1)=Z(t), because Z(t) is established as the lower boundof C(t) (Step 1060).

[0026] However, if C(t) is less than Z(t), the next bit to be decoded isthe LPS (Step 1070). When a least probable symbol occurs, C(t) fallsbetween A(t) and Z(t). To prepare for the next decoding iteration,C(t+1) should be bounded by A(t+1) and 1. Accordingly, the decodershifts the values of A(t) and C(t) in an amount sufficient to shift Z(t)to 1, the higher bound of C(t) (Step 1080). A(t+1)=A(t)+1−Z(t) andC(t+1)=C(t)+1−Z(t).

[0027] After step 1060 or step 1080, the decoder may re-normalize thevariables A(t) and C(t) (Step 1070). Re-normalization occurs when themost significant bit positions of C(t) and of A(t) are equal to one.When this occurs, the most significant bit position provides no moreuseful information to the decoding of data. The most significant bitposition is “consumed” by the decoding process.

[0028] The decoder of the present invention may be implemented in amicroprocessor or a digital signal processor. In such an implementation,values of A(t) and C(t) are stored in data registers having a fixedlength, such as 16 bit registers. Renormalization causes a shift of datain each register one bit position to the left. It shifts the mostsignificant bit out of A(t) and C(t). The shift of data in the registerstoring C(t) permits a new bit to be retrieved from the channel andstored in the least significant position in the register.

[0029] Because A(t) is always less than or equal to C(t), it isnecessary to test only the first bit position of A(t). If that bitposition is a one (1), then the decoder determines that renormalizationshift should be performed.

[0030] The method of FIG. 2 works so long as both the encoder and thedecoder use the same test values Z(t) for testing and adjusting thelower bound of register A(t).

[0031] The Z-Coder provides compression ratios that approach entropiccompression ratios. It provides a closer approximation of entropiccompression than prior art coders. Entropic compression is achieved whenZ(t) splits the interval [A(t), 1[ precisely in proportion with theprobabilities P_(LPS) and P_(MPS). For entropic compression:

Z _(e)(t)=1−(1−P _(LPS)) (1−A(t)=A(t)+P _(LPS)(1−A(t))

[0032] Unfortunately, calculation of a test value that achieves entropiccompression would require a multiplication to be performed, acomputationally slow operation. FIG. 3 illustrates lines representingthe test value Z(t) as a function of P_(LPS) for several values of A(t)under entropic conditions. The multiplication arises because each linehas a different slope. FIG. 4 illustrates an approximation used by theQM-Coder implemented to avoid the slow multiplications. The QM-Coderdeviates significantly from entropic compression.

[0033] The Z-Coder avoids slow multiplications. The Z-Coder computes anapproximation of the entropic test value using two line segments havingconstant slopes. Shown in FIG. 5, the first line segment has slope 1. Itis used for small values of P_(LPS). The second line segment has slope kand is used for large values of P_(LPS).

[0034] This solution is implemented by computing Z(t) as the minimum ofthe two following quantities:

Z1(t)=A(t)+p   (first line segment)

Z2(t)=½+A(t)/2+k(p−½)   (second line segment)

[0035] where p is approximately equal to but slightly lower thanP_(LPS). The computation of Z1(t) involves only an addition, acomputationally efficient operation. The computation of Z2(t) requires amultiplication but is subject to significant simplifications when k is apower of two:

[0036] when k=½, for instance, Z2(t) may be computed as ¼+Z1(t)/2.

[0037] when K=¼, for instance, Z2(t) may be computed as ⅜+[A(t)+Z1(t)]/4

[0038] Multiplication of binary numbers by values which are a power oftwo {fraction (1/4, 1/2)}, 2, 4, 8, . . . ) requires only a data shiftto be performed rather than a true multiplication. Thus, the simplifiedexpressions can be computed quickly.

[0039] The decoding algorithm of FIG. 2 may be implemented in softwarecode by the following subroutine:

[0040] boolean decoder (int p, boolean mps) {  z = a + p; // computeZ1(t)  d = 0x6000 + (z+a)>>2; // compute Z2(t) (here with k=1/4)  if (d< z) // compute Z(t) = min [Z1(t), Z2(t)]   z = d;  if (z > c)   { a +=0x10000−z; c += 0x10000−z; bit = 1−mps; }  else   { a = z; bit = mps} while (a >= 0x8000)   { a = (.(a − 0x8000)<<1);   c = ((c −0x8000)<<1) + next_code_bit(); }  return bit; }

[0041] The decoding method of FIG. 2 provides adaptive binary arithmeticdecoding that achieves compression ratios that are much closer toentropic compression ratios than are achieved by arithmetic decoders ofthe prior art. The Z-Coder provides much better data compression thanthe prior art adaptive binary arithmetic decoders.

[0042]FIG. 6 illustrates a method of operation of a decoder according toa second embodiment of the present invention. The decoding method 2000provides a fast decoding path for encoded MPS bits. Because the MPS is,by definition, the most probable symbol, the fast decoding path istraversed more often than other decoding paths. Fast decoding of theMPS, therefore, provides for improved performance.

[0043] The design of the fast decoder capitalizes upon the fact that anMPS may be returned as soon it is determined that Z1(t) is smaller thanC(t) and also smaller than ½:

[0044] Z(t) is rarely greater than ½because p is often very small;

[0045] Z(t) is rarely less than C(t) because PLPS is usually very small;and

[0046] Re-normalization rarely occurs because the compression ratio ofthe Z-Coder is very good (The decoding algorithm produces many more bitsthan it consumes).

[0047] The fast decoding method is initialized in the same manner as thetraditional method of FIG. 2. A(1) is set to 0; (Step 2010). The decoderreceives C(t) from the channel (Step 2020). The decoder computes a new“fence” variable, labeled F(t), to be the lesser of either C(t) or½(Step 2030). Further, the decoder computes Z1(t) as above (Step 2040).

[0048] The decoder compares Z1(t) against F(t) (Step 2050). If Z1(t) isless than F(t), the next bit to be decoded is an MPS. The decoderoutputs the MPS as the next bit in the decoded data and setsA(t+1)=Z1(t) (Steps 2060-2070). Next, the decoder loops back to Step2040.

[0049] If, at step 2050, Z1(t) is greater than F(t), the decodercomputes Z2(t) and finally determines Z(t) to be the minimum of Z1(t)and Z2(t) (Steps 2080-2110).

[0050] The decoder determines whether Z(t) is greater than C(t) (Step2120). If so, it decodes the next bit as an MPS and sets A(t+1)=Z(t) ina manner similar to steps 2060-2070 (Step 2130-2140). If, at step 2120,Z(t) is not greater than C(t), the decoder determines the next bit to bean LPS (Step 2150). It sets A(t+1)=A(t)+1−Z(t) and sets C(t)=C(t)+1−Z(t)(Step 2160).

[0051] Thereafter, the decoder may perform re-normalization in a mannersimilar to the decoding method of FIG. 2 (Step 2170). Afterrenormalization, the decoder loops back to step 2030 to compute a fencevariable for the next decoded bit position (t=t+1).

[0052] The optimized decoder may be implemented in software using thefollowing code:

[0053] boolean decoder_fast(int p, boolean mps) {  z=a + p; // ComputeZ1(t)  if (z<=fence)   {a=z; return mps} //Fast path returns MPSimmediately  d = 0x6000 + (z+a)>>2; // Compute Z2(t) (here with k=1/4) if (d < z) // compute Z(t) = min[Z1(t),Z2(t)]   z = d;  if (z > c)   }a += 0x10000−z; c += 0x10000−z; bit = 1−mps; }  else   } a = z; bit =mps; }  while ( a >= 0x8000)   { a = ((a − 0x8000)<<1);   c = ((c −0x8000)<<1) + next_code_bit(); }  fence = c;  if (fence >= 0x8000)   {fence = 0x7FFT; }  return bit; }

[0054] As is shown, if Z1(t) is less than or equal to F(t), labeled“fence” in the software description, the decoder performs only a singlestep and then returns. The remainder of the decoding sub-routine is notperformed. The fast decoder therefore provides improved decodingperformance by minimizing decoding latency.

[0055] The encoder performs data encoding using the same principles asthe decoding methods described above. A method of operation of anencoder constructed in accordance with an embodiment of the presentinvention is illustrated in FIG. 7. The encoder maintains a code stringinterval of the form [A(t)−S(t),1−S(t) [. The interval can beinterpreted as a lower bound A(t) on a number that plays the same rolethat C(t) does in the decoder. The code string is obtained bysubtracting S(t) from the number. The quantity S(t) accumulates all theterms that are added to C(t) in the LPS branch of the decoder describedabove with regard to either FIGS. 2 or 6.

[0056] To encode a MPS, a new interval [Z(t)−S(t),1−S(t)] must be set.This is achieved by setting A(t)+1=Z(t). To encode an LPS, a newinterval must be set to [A(t)−S(t), Z(t)−S(t) [which is readily achievedby setting A(t+1)=A(t)+1−Z(t) and S(t+1)=S(t)+1−z(t).

[0057] The encoding method is initialized by setting A(1) and S(1) to 0(Step 3010). Data to be encoded is input to the encoder (Step 3020).Encoding of a symbol begins with the computation of test value Z(t) justas in the decoding methods (Steps 3030-3070).

[0058] The encoder examines a bit in the data stream to be coded (Step3080). If the bit is an MPS, the encoder sets A(t+1)=Z(t) (Step 3090).If the bit is an LPS, the encoder sets A(t+1)=A(t)+1−Z(t) andS(t+1)=S(t)+1−Z(t) (Step 3100). These steps ensure that operation of theencoder and decoder track each other.

[0059] Coded data bits are emitted from the encoder only if A(t)≧½.While A(t)≧½, the decoder iteratively emits a bit of the code string (asthe most significant bit of 1−S(t)) and shifts A(t) and S(t) a bitposition to the left (Steps 3110-3130).

[0060] Thereafter, the encoder returns to step 3030 to decode anotherbit in the data string.

[0061] In a microprocessor or digital signal processor implementation,the encoder again stores values of A(t) and S(t) in data registershaving fixed lengths. However, it should be appreciated that when an LPSis encoded, the shift S(t+1)=S(t)+1−Z(t) may cause a carry in theregister storing the S value. The carry must be preserved. Accordingly,if a 16-bit register is used for example to store values of A(t), thenS(t) must be stored in a 17-bit register.

[0062] Because the result of register S can overflow to a 17^(th) bit,the subtraction in step 3120 can result in a negative number. S(t) canbe greater than 1. The borrow must be propagated through previouslyemitted bits in C(t). The Z-Coder borrow propagation is similar to thecarry propagation problem attendant in known binary arithmetic coders.The solutions obtained in the prior art apply equally well to theZ-Coder:

[0063] Bit counting consists of delaying issuance of the coded datastring until a one is emitted or until a borrow propagation turns allthe zeros into ones. This method may be implemented by keeping count ofthe number of zeros recently emitted.

[0064] Bit stuffing consists of inserting a dummy one when no lengths ofsequence of zeros exceed the predefined limit. Bit stuffing may reducethe compression ratio but it sets an upper limit on the delay betweenencoding of a symbol and the emission of the corresponding code bits.

[0065] The encoding method of FIG. 6 may be implemented in software,employing the follow code:

[0066] void encoder(boolean bit, int p, boolean mps) {  z = a + p;  d =0x6000 + (z+a)>>2; // compute Z2(t) (here with k=1/4)  if (d < z) //compute Z(t) = min [Z1(t),Z2(t)]   z = d;  if (bit == mps)   {a = z; } else   { s += 0x100000−z; a += 0x100000−z; }  while (a >= 0x8000)   {emit(l−(s>>15));  s (s&0x7fff)<<1; a + (a&0x7fff)<<1; } }

[0067] The encoders and decoders of the Z-Coding system use an incrementparameter p that represents the estimated probabilities of the LPS andMPS symbols. This section presents an analytic derivation of therelation between the symbol probability distribution P_(LPS) and theoptimal increment parameter p. This derivation relies on the analysis ofa theoretical experiment that included a decoding a random string ofindependent equiprobable bits with a particular value of the incrementp. The probability P_(LPS) in the decoded symbol string can becalculated with the following simplifying assumptions:

[0068] A(t) contains a uniform random number in internal [0, ½[. Thisuniform distribution hypothesis is reasonably supported by empiricalevidence, as long as the greatest common divisor of the increment p andthe interval size ½ is small.

[0069] C(t) contains a uniform random number in interval [A(t),1[. Thisassumption is implied by the definition of the lower bound A(t) and bythe random nature of the code string.

[0070] The assumptions also eliminate dependencies between consecutivedecoded symbols. It is assumes that each bit is decoded with randomvalues A(t) and C(t), regardless of previous decoding actions.Eliminating dependencies between consecutive symbols is surprisinglyrealistic. Real life applications tend to mix many streams of symbolswith different probabilities into a single arithmetic coder. Theinterleaved mixture randomizes A(t) and C(t) quite efficiently.

[0071] Under these assumptions, the decoded symbols are independentidentically distributed random variables. The probability of LPS can bederived using the following decomposition:

[0072] P*(LPS)=P{Z1(t)<Z2(t)} P{Z1(t)>C(t) | Z1(t)<Z2(t)}

[0073] =P{Z1(t)>Z2(t)} P{Z2(t)>C(t) | Z1(t)>Z2(t)}

[0074] Using this decomposition and the simplifying assumptionsdescribed above, a simple exercise in integral calculus providesanalytical formulas relating P*(LPS) and p for each chosen value of theslope k (see, FIG. 8).

[0075] The case k=½, for instance, resolves to the following formula:

P*(LPS)=p−(p+½) log (p+½)−(p−½) log ½

[0076] Decoding a random sequence of independent equiprobable bitsproduces a random sequence of independent symbols distributed as derivedabove. Conversely, encoding such a random sequence of symbols, under thesame assumptions, produces a random sequence of equiprobable bits. Thatmeans that the increment p is the optimal increment for symbol stringdistribution P*(LPS).

[0077] This formula has been confirmed by empirical experiments seekingthe optimum increment for chosen symbol probability distributions.Encoding a random symbol string with this optimal increment producesabout 0.5% more code bits than predicted by the information theoreticallimit. This is probably the price of the additive approximation to thecomputation of the z-value.

[0078] This following discussion presents a stochastic algorithm thatautomatically adapts the Z-Coder parameters (p and MPS) while encodingor decoding symbol strings.

[0079] The adaptation algorithm must remember some information about theobserved symbol frequencies in the symbol string. It is convenient inpractice to represent this information as a single integer state.Typical data compression applications maintain an array of statevariables (also called “coding contexts”). Each symbol is encoded with acoding context chosen according to application specific priorinformation about its probability distribution.

[0080] The integer state is used as an index into a table defining theactual coder parameters, i.e., the identity of the MPS (zero or one) andthe probability P_(LPS) (a number in [0, ½]). The Z-Coder adaptationalgorithm modifies the value of the state variable when certainconditions are verified:

[0081] Encoding or decoding an LPS always triggers an LPS adaptation.The state variable is then changed to point a table entry with a largervalue of the increment p, or, if the increment is already large, topoint a table entry with swapped definition of the MPS and LPS symbols.

[0082] Encoding or decoding an MPS triggers an MPS adaptation if andonly if A(t) is greater than a threshold m in [½-p, ½[ tabulated as afunction of the current state. The state variable is changed to point atable entry with a smaller value of the increment p. In anotherembodiment encoding or decoding a MPS triggers a MPS adaptation if andonly if Z(t), which is related to A(t) in a known way, is greater than athreshold tabulated as a function of the current state.

[0083]FIG. 9 illustrates a method of operation 3000 of a decoder thatintegrates adaptation with the fast decoding of FIG. 6. Like steps fromFIG. 6 are indicated with like reference numerals. After step 2130, whenthe decoder determines that a next bit to be decoded is an MPS, thedecoder tests for MPS adaptation. Specifically, the decoder determineswhether A(t)>m, the threshold test variable for MPS adaptation (Step3010). If so, the decoder performs the MPS adaptation (Step 3020).Thereafter, or if Z(t) fails the threshold of step 3010 (Z(t)≧m), thedecoder resets A(t) for the next iteration (Step 2070). Equivalently,the decoder may test Z(t) against m.

[0084] At step 2150, when the decoder determines that the next bit to bedecoded is an LPS, the decoder always performs LPS adaptation (Step3030).

[0085] The remaining discussion pertains to symmetrical lineartransition tables. These tables are organized like a ladder. The firstrung represents the symbol distribution with the highest probability ofzeroes. The last rung represents a symbol distribution with the highestdistribution of ones. Each LPS transition moves the state variable onstep towards the center of the ladder. Each MPS transition moves thestate variable one step towards the closest tip of the ladder.

[0086] The limiting distribution of the state variable depends on therespective probabilities of the adaptation events. In the case of asymmetrical transition table, these probabilities must fulfill thefollowing conditions:

[0087] P(MPS adaptation)<P(LPS adaptation) if p is too small

[0088] P(MPS adaptation)>P(LPS adaptation) if p is too large

[0089] P(MPS adaptation)=P(LPS adaptation) if p is optimal

[0090] These conditions imply that the probability of both adaptationevents must have the same order of magnitude. The Z-Coder adaptationalgorithm uses Z(t) as a pseudo-random number generator to tune theprobability of the MPS adaptation events.

[0091] Analytical expressions for the probabilities of the adaptationevent are derived by assuming again that the lower bound register acontains a uniform random number in [0, ½[. The following formulae areeasily obtained by analyzing the encoding algorithm:

[0092] P(LPS adaptation)=P(LPS)=P_(LPS)

[0093] P(MPS adaptation)=P(A(t)>m|IMPS) P(MPS)=(1-2m) (1-P_(LPS))

[0094]FIG. 8 compares the adaptation event probabilities as a functionof the optimal increment p when the threshold m is equal to ½. Thesecurves show that this value of the threshold makes the probability ofthe MPS adaptation event too high. A larger threshold is needed toreduce the probability of MPS adaptation event until it becomes equal tothe probability of LPS adaptation event.

[0095] For each value of the state variable, a threshold m is chosen inorder to ensure that both adaptation events occur with the sameprobability when the increment p is optimal for the current value ofP_(LPS). The following expression gives the correct value of thethreshold m as a function of the optimal increment p:

m=½(1−P* (LPS) ))

[0096] where P*(LPS) is the expression derived above.

[0097] The Z-Coder adaptation algorithm differs significantly from theadaptation scheme introduced by the Q-Coder and used by the QM-Coder.These coders perform a MPS adaptation whenever encoding or decoding aMPS produces or consumes a code bit. This is similar to using a constantthreshold m=½with the Z-coder Coder adaptation algorithm. An optimallytuned Q-Coder or QM-Coder therefore produces more MPS adaptation eventsthan LPS adaptation events. This is compensated by a careful design ofasymmetrical state transition tables.

[0098] The Z-Coder state transition tables however are free of theseconstraints. This can be a significant advantage for creating efficientstate transition tables in an analytically principled way.

[0099] The encoder or decoder of the present invention may be providedon a processor or digital signal processor with appropriate programinstructions.

[0100] As shown herein, the Z-Coder is an adaptive binary arithmeticcoder having the following characteristics:

[0101] A new multiplication-free approximation of the interval splittingpoint provides an improved coding accuracy.

[0102] The decoder only keeps a lower bound on the code number, asimplification that leads to very fast implementation of the decodingalgorithm.

[0103] The two registers used by both the encoding and the decodingalgorithm require only sixteen bits and a carry bit, an implementationbenefit that reduces the cost of implementation of the Z-Coder.

[0104] A new probability adaptation scheme reduces the constraints onstate transition tables.

We claim:
 1. A method for decoding coded data into a decoded symbolstring populated by more probable symbols (“MPS”) and less probablesymbols (“LPS”), the method comprising the steps of: receiving a segmentof coded data interpreted as a binary fraction C; defining a codinginterval of possible values of C, the interval extending from a variablelower bound A to a constant upper bound 1; for each position in thedecoded symbol string: computing a test value Z subdividing the codinginterval into sub-intervals in accordance with the relativeprobabilities that an MPS and an LPS occurs in the position, a firstsub-interval extending from the lower bound A to the test value Z, thesecond sub-interval extending from the test value Z to 1; if C isgreater than Z: placing an MPS at the current position in the decodedsymbol string, and setting the lower bound A to the test variable Z foruse in decoding of a next position in the decoded symbol string; and ifC is less than Z: placing an LPS at the current position in the decodedsymbol string, and computing a new lower bound A and a new binaryfraction C for use in decoding of the next position in the decodedsymbol string.
 2. The method of claim 1 , wherein the computation of thetest value Z comprises the steps of: computing a first test value Z1derived from the lower bound A and from a current estimate P of theprobability of the LPS symbol, computing a second test value Z2 derivedthe lower bound A and from the current estimate P of the probability ofthe LPS symbol, setting the test value Z to the lesser of Z1 and Z2. 3.The method of claim 1 , wherein Z1 and Z2 are computed according to:Z1=A+P/R1, and Z2=½A2−(½−P)/R2, wherein R1 and R2 are powers of two. 4.The method of claim 3 , wherein R2 is twice R1.
 5. The method of claim 3, wherein R2 is four times R1.
 6. The method of claim 2 , comprising theadditional step of: defining a fence variable F; if the first test valueZ1 is smaller than the fence variable F; placing an MPS at the currentposition in the decoded symbol string, setting the lower bound A to thetest variable Z1 for use in decoding of a next position in the decodedsymbol string, and immediately proceeding decoding of next position inthe decoded symbol string; and whenever the binary fraction C ismodified by the decoding process, redefining the fence variable F to beless than the binary fraction C.
 7. The method of claim 1 , furthercomprising, when a predefined criterion is met, updating both the binaryfraction C and the new lower bound A in order to accommodate a newsegment of coded data.
 8. The method of claim 7 , wherein thepredetermined criterion is met when a symbol within C is consumed. 9.The method of claim 1 , wherein the computation of the test value Zdepends on the value of a parameter P approximating a probability of theoccurrence of LPS symbols in the decoded symbol string, said methodcomprising the additional steps of: if the decoded symbol is a LPS,setting the parameter P to a value representing an increased estimatedprobability for the LPS symbol; and if the decoded symbol is a MPS;comparing the lower bound A with a threshold value M depending on P, andif the lower bound A is greater than the threshold value M, setting theparameter P to a value representing a decreased estimated probabilityfor the LPS symbol.
 10. The method of claim 9 , wherein the parameter Pis indirectly represented by an integer index for accessing tableentries specifying: the actual value of the parameter P, the value ofthe threshold M, the new value of the index used for representing anincreased estimated probability for the LPS symbol and the new value ofthe index used for representing a decreased estimated probability forthe LPS symbol.
 11. The method of claim 1 , wherein the computation ofthe test value Z depends on the value of a parameter P representing theestimated probability of the LPS symbols, said method comprising theadditional step of: if the decoded symbol is an LPS, setting theparameter P to a value representing an increased estimated probabilityfor the LPS symbol. if the decoded symbol is a MPS, comparing the testvalue Z with a threshold value M depending on P, and if the test value Zis greater than the threshold value M, setting the parameter P to avalue representing a decreased estimated probability for the LPS symbol.12. The method of claim 10 , wherein the parameter P is indirectlyrepresented by an integer index for accessing table entries specifying:the actual value of the parameter P, the value of the threshold M, thenew value of the index used for representing an increased estimatedprobability for the LPS symbol and the new value of the index used forrepresenting a decreased estimated probability for the LPS symbol.
 13. Amethod for encoding data, the data represented by a symbol stringpopulated by more probable symbols (“MPS”) and less probable symbols(“LPS”), the method comprising the steps of: initializing a codeaccumulator S; defining a coding interval extending from a variablelower bound A to a constant upper bound 1; for each position in thesymbol string: computing a test value Z subdividing the coding intervalinto sub-intervals in accordance with the relative probabilities of anMPS and an LPS occur in the position, a first sub-interval extendingfrom the lower bound A to the test value Z, the second sub-intervalextending from the test value Z to 1; if the symbol located at thecurrent position in the symbol string is a MPS, setting the lower boundA to the test variable Z for use in encoding of a next position in thedecoded symbol string; if the symbol located at the current position inthe symbol string is an LPS, adding the length of the secondsub-interval to the accumulator S, and computing a new lower bound A foruse in encoding of a next position in the decoded symbol string; andwhen a predefined criterion is met, outputting a segment of coded dataand computing new values for both the accumulator S and the lower boundA.
 14. The method of claim 13 , wherein the computation of the testvalue Z comprises the steps of: computing a first test value Z1 derivedfrom the lower bound A and from a current estimate P of the probabilityof the LPS symbol, computing a second test value Z2 derived the lowerbound A and from the current estimate P of the probability of the LPSsymbol, setting the test value Z to the lesser of Z1 and Z2.
 15. Themethod of claim 14 , wherein Z1 and Z2 are computed according to:Z1=A+P/R1and Z2=½+A/2−(½−P)/R2, wherein R1 and R2 are powers of two. 16.The method of claim 15 , wherein R2 is twice R1.
 17. The method of claim15 , wherein R2 is four times R1.
 18. The method of claim 13 , whereinthe computation of the test value Z depends on the value of a parameterP approximating a probability of the occurrence of LPS symbols in thedecoded symbol string, said method comprising the additional steps of:if the decoded symbol is a LPS, setting the parameter P to a valuerepresenting an increased estimated probability for the LPS symbol; andif the decoded symbol is a MPS; comparing the lower bound A with athreshold value M depending on P, and if the lower bound A is greaterthan the threshold value M, setting the parameter P to a valuerepresenting a decreased estimated probability for the LPS symbol. 19.The method of claim 18 , wherein the parameter P is indirectlyrepresented by an integer index for accessing table entries specifying:the actual value of the parameter P, the value of the threshold M, thenew value of the index used for representing an increased estimatedprobability for the LPS symbol and the new value of the index used forrepresenting a decreased estimated probability for the LPS symbol. 20.The method of claim 13 , wherein the computation of the test value Zdepends on the value of a parameter P representing the estimatedprobability of the LPS symbols, said method comprising the additionalstep of: if the decoded symbol is an LPS, setting the parameter P to avalue representing an increased estimated probability for the LPSsymbol. if the decoded symbol is a MPS, comparing the test value Z witha threshold value M depending on P, and if the test value Z is greaterthan the threshold value M, setting the parameter P to a valuerepresenting a decreased estimated probability for the LPS symbol. 21.The method of claim 20 , wherein the parameter P is indirectlyrepresented by an integer index for accessing table entries specifying:the actual value of the parameter P, the value of the threshold M, thenew value of the index used for representing an increased estimatedprobability for the LPS symbol and the new value of the index used forrepresenting a decreased estimated probability for the LPS symbol.
 22. Amethod of decoding coded data into decoded data, the decoded datarepresented by a symbol string of more probable symbols (“MPS”) and lessprobable symbols (“LPS”), the method comprising: receiving a segment ofcoded data as a binary fraction, for a position in the decoded symbolstring, defining an interval of possible values of the coded data, theinterval bounded by 1 and a lower bound, computing a test variable thatdivides the interval into two sub-intervals according to relativeprobabilities that the symbol should be occupied by the MPS or the LPS,a first sub-interval extending from 1 to the test variable andassociated with the MPS, a second sub-interval extending from the testvariable to the lower bound and associated with the LPS, when the codeddata segment occupies the first sub-interval, placing an MPS in theposition, and when the coded data segment occupies the secondsub-interval, placing an LPS in the position.
 23. The method of claim 1, further comprising a step of, when an MPS is placed in the position,setting the lower bound to the test variable for use in decoding of anext position in the decoded symbol string.
 24. The method of claim 1 ,further comprising a step of, when an LPS is placed in the position,incrementing both the lower bound and the coded data segment by anamount representing a difference between 1 and the test variable for usein decoding of a next position in the decoded symbol string.
 25. Themethod of claim 1 , further comprising a step of renormalizing thevalues of the coded data segment and the lower bound when a bit in thecoded data segment has been consumed.
 26. The method of claim 25 ,wherein the renormalizing step causes data of the coded data segment andthe lower bound to be shifted one bit to the left.
 27. The method ofclaim 25 , wherein the renormalizing step includes a step of testing amost significant bit position of the lower bound and determining thatthe bit in the coded data segment has been consumed when the mostsignificant bit position of the lower bound is a
 1. 28. The method ofclaim 1 , wherein the test variable is computed according to the formulaZ=A+p, wherein Z represents the value of the test variable, A representsa value of the lower bound and p represents an approximation of theprobability of the occurrence of the LPS.
 29. A method of decoding codeddata into decoded data, the decoded data represented by a symbol stringof more probable symbols (“MPS”) and less probable symbols (“LPS”), themethod comprising: receiving a segment of coded data as a binaryfraction, for a position in the decoded symbol string, defining aninterval of possible values of the coded data, the interval bounded 1and a lower bound, computing a test variable that divides the intervalinto two sub-intervals according to relative probabilities that thesymbol should be occupied by the MPS or the LPS, a first sub-intervalextending from 1 to the test variable and associated with the MPS, asecond sub-interval extending from the test variable to the lower boundand associated with the LPS, computing a fence variable to be the lesserof the coded data segment and ½, and when the test variable is less thanthe fence variable, placing an MPS in the position.
 30. The method ofclaim 29 , further comprising steps of, when the test variable isgreater than the fence variable, determining whether the test variableis greater than the coded data segment and, if so, placing an MPS in theposition.
 31. The method of claim 30 , further comprising a step of,when an MPS is placed in the position, setting the lower bound to thetest variable for use in decoding of a next position in the decodedsymbol string.
 32. The method of claim 29 , further comprising step of,when the test variable is greater than the fence variable, determiningwhether the test variable is less than the coded data segment and, ifso, placing an LPS in the position.
 33. The method of claim 32 , furthercomprising a step of, when an LPS is placed in the position,incrementing both the lower bound and the coded data segment by anamount representing a difference between 1 and the test variable for usein decoding of a next position in the decoded symbol string.
 34. Amethod of decoding coded data into decoded data, comprising the stepsof: receiving a segment of coded data as a binary fraction, for aposition in the decoded symbol string, defining an interval of possiblevalues of the coded data, the interval bounded by 1 and a lower bound,computing a test variable that divides the interval into twosub-intervals according to relative probabilities that the symbol shouldbe occupied by the MPS or the LPS, a first sub-interval extending from 1to the test variable and associated with the MPS, a second sub-intervalextending from the test variable to the lower bound and associated withthe LPS, computing a fence variable to be the lesser of the coded datasegment and ½, decoding an MPS for the position when either of thefollowing conditions occur: the test variable is less than the fencevariable, and the when the test variable is less than the segment ofcoded data, and decoding an LPS for the position and performing LPSadaptation when neither of the conditions occur.
 35. The method of claim34 , further comprising, when an MPS is decoded, determining whether thetest variable is greater than an MPS adaptation test variable and, ifso, performing MPS adaptation.
 36. A method of decoding coded data, thecoded data representing a sequence of symbols including a most probablesymbol (“MPS”) and a least probable symbol (“LPS”), the methodcomprising: receiving a segment of the coded data as a fractional value;initializing a variable representing a lower limit on possible values ofthe segment of coded data to equal zero; and iteratively, calculating atest variable that divides an interval from the lower limit to oneaccording to relative probabilities that a next symbol to be decoded isan LPS or an MPS, calculating a fence variable representing the lesserof one half and the value of segment of coded data, decoding the nextsymbol to be an MPS when the test variable is less than the fencevariable, otherwise, decoding the next symbol to be an MPS when the testvariable is less than the value of segment of coded data, otherwise,decoding the next symbol to be an LPS, when an MPS is decoded, settingthe lower limit for a next iteration equal to the test variable, andwhen an LPS is decoded, setting the lower limit and the segment of codeddata equal to their respective values for the instant iteration added byan amount equal to the difference between the test variable and
 1. 37.The method of claim 36 , further comprising, when an MPS is decoded,determining whether the test variable is greater than an MPS adaptationthreshold and, if so, performing MPS adaptation.
 38. The method of claim36 , further comprising, when an LPS is decoded, performing LPSadaptation.
 39. A decoder adapted to perform the following functions:receive a segment of the coded data as a fractional value; initialize avariable representing a lower limit on possible values of the segment ofcoded data to equal zero; and iteratively, calculate a test variablethat divides an interval from the lower limit to one according torelative probabilities that a next symbol to be decoded is an LPS or anMPS, calculate a fence variable representing the lesser of one half andthe value of segment of coded data, decode the next symbol to be an MPSwhen the test variable is less than the fence variable, otherwise,decode the next symbol to be an MPS when the test variable is less thanthe value of segment of coded data, otherwise, decode the next symbol tobe an LPS, when an MPS is decoded, set the lower limit for a nextiteration equal to the test variable, and when an LPS is decoded, setthe lower limit and the segment of coded data equal to their respectivevalues for the instant iteration added by an amount equal to thedifference between the test variable and
 1. 40. The decoder of claim 39, wherein the decoder, when an MPS is decoded, determines whether thetest variable is greater than an MPS adaptation threshold and, if so,performs MPS adaptation.
 41. The decoder of claim 39 , wherein thedecoder, when an LPS is decoded, performs LPS adaptation.